package com.sample;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * Created by leo.na on 21/03/2017.
 */
@Component
public class KresnaApiApplicationContextListener implements ApplicationListener<ContextRefreshedEvent> {

    private static final Logger log = LoggerFactory.getLogger(KresnaApiApplicationContextListener.class);

    @Autowired
    private KresnaApiApplicationBootstrap kresnaApiApplicationBootstrap;

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        log.info("onApplicationEvent...");
        kresnaApiApplicationBootstrap.run();
    }

}
